<?php

$regsxpag = 5;

if (isset($_GET['action'])) {
    $errores = array();
    $exitos = array();
    $clientes = array();
    $creating = '';
    $modifying = '';
    $nreg = '';
    $pagina = '';
    
    switch ($_GET['action']) {
        
        case 'create':
            require 'models/op/op_clients.inc.php';
            $creating = 1;
            if (isset($_POST['submit'])) {
                opCreateClient($errores, $exitos);
            }
            break;

        case 'modify':
            require 'models/op/op_clients.inc.php';
            $modifying = $_GET['cliente_dni'];
            if (isset($_POST['submit'])) {
                opModifyClient($errores, $exitos);
                unset($modifying);
            }
            $clientes = opListClients($nreg, $regsxpag, $pagina);
            $cuotas = getCuotas($_SESSION['gim_id']);
            break;

        case 'delete':
            require 'models/op/op_clients.inc.php';
            opDeleteClient($errores, $exitos);
            $clientes = opListClients($nreg, $regsxpag, $pagina);
            break;

        case 'list':
            require 'models/op/op_clients.inc.php';
            $clientes = opListClients($nreg, $regsxpag, $pagina);
            break;  
    }
}
?>
